package com.all.play.myapplication.moudle;

import android.content.Context;

import com.all.play.myapplication.moudle.dao.UserAccountDao;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created by 聪明一只哈 on 2018/3/30.
 */

public class Model {

    private Context context;

    //定义全局线程池
    private ExecutorService executor= Executors.newCachedThreadPool();

    private static Model model=new Model();
    private UserAccountDao userAccountDao;

    private Model() {
    }

    //单利
    public static Model getInstance(){
        return model;
    }

    //初始化
    public void init (Context context){
        this.context=context;

        //创建用户账号对象
        userAccountDao = new UserAccountDao(context);
    }

    //获取线程池
    public ExecutorService getGloableThreadPool(){
        return  executor;
    }


    //登录成功
    public void loginSuccess() {


    }


    //获取用户账号的操作类对象
    public UserAccountDao getUserAccountDao(){
        return userAccountDao;
    }

}
